import { Sequelize } from "sequelize"

export const sequelize = new Sequelize({
    dialect: 'sqlite',
    storage: './db.db'
})


export const sync = async () => {
    let { Blog } = await import('../model/Blog.js')
    //强制删除数据库， 重来
    await sequelize.sync({ force: true })
    let arr=[
        {
            title:'Java',
            author:'张三',
        },
        {
            title:'Mysql',
            author:'李四',
        },
        {
            title:'Vue',
            author:'王五',
        },
        {
            title:'Radis',
            author:'赵六',
        },
    ]
      Blog.bulkCreate(arr)
}